package com.qf.job;

import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;

/**
 * 分布式任务, 业务处理方法
 * @author zhaojian
 */
@Component
public class MyJob implements SimpleJob {

    @Override
    public void execute(ShardingContext shardingContext) {
        int count = shardingContext.getShardingItem();
        switch (count) {
            case 0:
                // do something by sharding item 0
                System.out.println("=====定时任务执行的一次=====");
                break;
            case 1:
                // do something by sharding item 1
                System.out.println("111111111111111");
                break;
            case 2:
                // do something by sharding item 2
                System.out.println("222222222222222");
                break;
            // case n: ...
        }

    }

}
